from django.http import Http404
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.template import Context, loader
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import get_object_or_404, render_to_response
from django.core.urlresolvers import reverse
from finance.models import Account
from exchange.models import Event

def index(request):
  events = Event.objects.all()
  balance = Account.objects.get(user=request.user).balance
  return render_to_response('exchange/index.html', {
      'user': request.user,
      'balance': balance,
      'events': events,
  }, context_instance=RequestContext(request))